/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.omazan.db.models;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author stryke
 */
@Entity
@Table(name = "EXCEPTIONS", catalog = "OMAZANDB", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Exceptions.findAll", query = "SELECT e FROM Exceptions e"),
    @NamedQuery(name = "Exceptions.findByExceptionId", query = "SELECT e FROM Exceptions e WHERE e.exceptionId = :exceptionId"),
    @NamedQuery(name = "Exceptions.findByException", query = "SELECT e FROM Exceptions e WHERE e.exception = :exception"),
    @NamedQuery(name = "Exceptions.findByIsActive", query = "SELECT e FROM Exceptions e WHERE e.isActive = :isActive")})
public class Exceptions implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "exceptionId", nullable = false)
    private Integer exceptionId;
    @Size(max = 255)
    @Column(name = "exception", length = 255)
    private String exception;
    @Basic(optional = false)
    @NotNull
    @Column(name = "isActive", nullable = false)
    private boolean isActive;
    @OneToMany(mappedBy = "exceptionId", fetch = FetchType.LAZY)
    private Collection<Shipments> shipmentsCollection;

    public Exceptions() {
    }

    public Exceptions(Integer exceptionId) {
        this.exceptionId = exceptionId;
    }

    public Exceptions(Integer exceptionId, boolean isActive) {
        this.exceptionId = exceptionId;
        this.isActive = isActive;
    }

    public Integer getExceptionId() {
        return exceptionId;
    }

    public void setExceptionId(Integer exceptionId) {
        this.exceptionId = exceptionId;
    }

    public String getException() {
        return exception;
    }

    public void setException(String exception) {
        this.exception = exception;
    }

    public boolean getIsActive() {
        return isActive;
    }

    public void setIsActive(boolean isActive) {
        this.isActive = isActive;
    }

    @XmlTransient
    public Collection<Shipments> getShipmentsCollection() {
        return shipmentsCollection;
    }

    public void setShipmentsCollection(Collection<Shipments> shipmentsCollection) {
        this.shipmentsCollection = shipmentsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (exceptionId != null ? exceptionId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Exceptions)) {
            return false;
        }
        Exceptions other = (Exceptions) object;
        if ((this.exceptionId == null && other.exceptionId != null) || (this.exceptionId != null && !this.exceptionId.equals(other.exceptionId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.omazan.entities.Exceptions[ exceptionId=" + exceptionId + " ]";
    }
    
}
